<%@ Page Language="C#" debug="true" %>
<%@ Register Namespace=MyControls.DataSources.CompositeHierarchicalDataSource TagPrefix=my %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <my:CompositeHierarchicalDataSource runat=server ID=Composite1 RootViewName="Categories:DefaultView">
        <DataSources>
            <asp:ObjectDataSource ID="Categories" Runat="server" TypeName="Categories" SelectMethod="GetCategories" />
            <asp:AccessDataSource ID="SubCategories" Runat="server" DataFile="~/App_Data/things.mdb"
                SelectCommand="SELECT [Id], [CategoryId], [Name] FROM [SubCategories]"/>
            <asp:AccessDataSource ID="Things" Runat="server" DataFile="~/App_Data/things.mdb"
                SelectCommand="SELECT [Id], [SubCategoryId], [Name], [Description], [Url] FROM [Things]"/>
        </DataSources>
        <Relations>
            <my:Relation ParentDataSourceId="Categories" ParentView="DefaultView" ParentColumns="value"
                ChildDataSourceId="SubCategories" ChildView="DefaultView" ChildColumns="CategoryId"/>
            <my:Relation ParentDataSourceId="SubCategories" ParentView="DefaultView" ParentColumns="Id"
                ChildDataSourceId="Things" ChildView="DefaultView" ChildColumns="SubCategoryId"/>
        </Relations>
    </my:CompositeHierarchicalDataSource>
    
    <asp:Menu Runat=Server ID=myMenu DataSourceID=Composite1>
        <DataBindings>
            <asp:MenuItemBinding DataMember="Categories:DefaultView" TextField="text" ValueField="value" />
            <asp:MenuItemBinding DataMember="SubCategories:DefaultView" TextField="Name" ValueField="Id" />
            <asp:MenuItemBinding DataMember="Things:DefaultView" TextField="Name" ValueField="Id" ToolTipField="Description" NavigateUrlField="Url" />
        </DataBindings>
    </asp:Menu>
    </div>
    </form>
</body>
</html>
